package com.example.xpvideo.Controller;

import com.example.xpvideo.entity.Notice;
import com.example.xpvideo.entity.PageResult;
import com.example.xpvideo.entity.QualificationConfig;
import com.example.xpvideo.entity.ResponseResult;
import com.example.xpvideo.entity.req.NoticeReq;
import com.example.xpvideo.entity.req.QualificationConfigReq;
import com.example.xpvideo.entity.req.UpdateReq;
import com.example.xpvideo.service.NoticeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.constraints.NotNull;
import java.util.List;

/**
 * @author : 洪俊新
 * @date : 2021/9/9 17:24
 * @description:
 */
@RestController
@RequestMapping("/back/notice")
public class PhpNoticeController {
    @Autowired
    private NoticeService noticeService;

    @GetMapping("/list")
    public ResponseResult<PageResult<List<Notice>>> list(NoticeReq noticeReq)
            throws Exception{
        return noticeService.list(noticeReq);
    }
    @PostMapping("/delete")
    public ResponseResult<Object> delete(@NotNull @RequestBody UpdateReq updateReq)
            throws Exception{
        return noticeService.delete(updateReq);
    }

    @PostMapping("/insert")
    public ResponseResult<Object> insert(@RequestBody Notice notice)
            throws Exception{
        return noticeService.insert(notice);
    }

    @PostMapping("/update")
    public ResponseResult<Object> update(@RequestBody Notice notice)
            throws Exception{
        return noticeService.update(notice);
    }
}
